$(function () {
    initMap();
});

function initMap() {
    var param = {};
    param.areaName = "陕西";
    map = MapUtil.createMap("map", {}, param);
    var drawingManager = MapUtil.drawingManager(map, function (param) {
        $("#lngLatList").val(param.lngLatList);
        $("#centerPoint").val(param.centerLng + "," + param.centerLat);
        $("#areaValue").val(param.areaValue);
        $("#zoom").val(param.zoom);
        $(".area-info").show();
    });
}

function clearAreaInfo() {
    MapUtil.clearAll(map);
    $(".area-info").hide();
}

function toggleAreaInfo() {
    var $body = $(".panel-body");
    if($body.is(":hidden")){
        $body.slideDown();
        $(".btn-toggle").text("折叠面板");
    }else{
        $body.slideUp();
        $(".btn-toggle").text("展开面板");
    }
}

function saveAreaInfo() {
    BootstrapDialog.show({
        title: '保存确认',
        message: '是否保存当前区域信息？',
        buttons: [{
            label: '保存',
            action: function (dialog) {
                dialog.close();
            }
        }, {
            label: '取消',
            action: function (dialog) {
                dialog.close();
            }
        }]
    });
}
